<!-- 选择钱包 -->
<template>
  <div class="select">
    <x-header :left-options="{backText: ''}">选择钱包</x-header>
    <div style="margin-top: 5px;">
      <div v-for="wallet in walletList" @click="goTransferOut(wallet)" class="walletSty">
        <img src="../../assets/walletIconImg.png" alt="" width="20" height="20" style="vertical-align: middle;margin-left:15px">
        <span>{{wallet.address}}</span>
      </div>
    </div>
  </div>
  </div>
</template>
<script>
  import { XHeader, Radio, Group } from 'vux'
  import http from '../../service/http.js'
  export default {
    data() {
      return {
        walletList: [],
        type: "",
      }
    },
    components: {
      XHeader,
      Radio,
      Group
    },
    mounted() {
      this.type = this.$route.query.type;
      this.status = this.$route.query.status;
      this.getWalletAddress();
    },
    methods: {
      goTransferOut(wallet) {
        if (this.type && this.status == 1) {
          this.$router.push({ path: "/main/turnIn?id=" + wallet.id + "&type=" + this.type + "&name=" + wallet.type });
          return false;
        }
        if (this.type) {
          this.$router.push({ path: "/main/transferOut?id=" + wallet.id + "&type=" + this.type + "&name=" + wallet.type });
          return false;
        }
      },
      // 获取钱包地址
      getWalletAddress() {
        http.get("/user/address").then((res) => {
          if (res.status == 200) {
            this.walletList = res.data.body;
          }
        })

      },
    }
  }
</script>
<style lang="less">
  body {
    background: #f6f6f6;
  }

  .select .vux-header {
    background: #fff;
  }

  .select .vux-header .vux-header-title {
    line-height: 40px;
    text-align: center;
    font-size: 18px;
    font-weight: 400;
    color: #000;
  }

  .select .vux-header .vux-header-left .left-arrow:before {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    border: 1px solid #000;
    border-width: 1px 0 0 1px;
    -webkit-transform: rotate(315deg);
    transform: rotate(315deg);
    top: 8px;
    left: 7px;
  }

  .select {
    position: relative;
  }

  .select .addSelectImg {
    position: absolute;
    top: 11px;
    right: 15px;
  }

  .select .weui-cells_radio .weui-check:checked+.weui-icon-checked:before {
    display: block;
    content: '\EA08';
    color: #ff9900;
    font-size: 16px;
  }
  .walletSty{
    height: 40px;
    line-height: 40px;
    border-bottom: 1px;
    background: #fff;
    border-bottom: 1px solid #f6f6f6;
  }
</style>